from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Regexp, DataRequired, Length
from cyoa.models import Wizard


class LoginForm(FlaskForm):
    wizard_name = StringField('Wizard Name',
                              validators=[DataRequired(), Length(1, 32)])
    password = PasswordField('Password', validators=[DataRequired(),
                                                     Length(1, 32)])


class PresentationForm(FlaskForm):
    name = StringField('Presentation name', validators=[DataRequired(),
                                                        Length(1, 60)])
    filename = StringField('File name', validators=[DataRequired(),
                                                    Length(1, 255)])
    slug = StringField('URL slug', validators=[DataRequired(),
                                               Length(1, 255)])
    is_visible = BooleanField()


class DecisionForm(FlaskForm):
    slug = StringField('URL slug', validators=[DataRequired(),
                                               Length(1, 128)])
    first_path_slug = StringField('A word for the first path. Must be '
                                  'lowercase. No spaces.',
                                  validators=[DataRequired(), Length(1, 64),
                                              Regexp('[a-z0-9]+', message=
                                              'Choice must be lowercase '
                                              'with no whitespace.')])
    second_path_slug = StringField('A word for the second path. Must be '
                                   'lowercase. No spaces.',
                                   validators=[DataRequired(), Length(1, 64),
                                               Regexp('[a-z-0-9]+', message=
                                               'Choice must be lowercase '
                                               'with no whitespace.')])
